﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Ini;

namespace TwipPlays
{
    public partial class Server : Form
    {
        public Server()
        {

            InitializeComponent();

            // Initialize values
            IniFile ini = new IniFile("irc_parser/config.ini");

            // Get settings & assign to entries
            string server = ini.IniReadValue("server", "server");
            string user = ini.IniReadValue("server", "user");
            string auth = ini.IniReadValue("server", "auth");
            string channel = ini.IniReadValue("server", "channel");

            this.server_entry.Text = server;
            this.user_entry.Text = user;
            this.auth_entry.Text = auth;
            this.channel_entry.Text = channel;

        }

        private void save_clicked(object sender, EventArgs e)
        {

            // Save values
            IniFile ini = new IniFile("irc_parser/config.ini");

            ini.IniWriteValue("server", "server", this.server_entry.Text);
            ini.IniWriteValue("server", "user", this.user_entry.Text);
            ini.IniWriteValue("server", "auth", this.auth_entry.Text);
            ini.IniWriteValue("server", "channel", this.channel_entry.Text);

            this.Close();

        }

        private void cancel_clicked(object sender, EventArgs e)
        {

            this.Close();

        }
    }
}
